package 设计模式.行为型.observer观察者.event;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 测试事件发布
 *
 * @author: 张从龙
 * time: 2022/8/19 13:41
 */
public class TestPublisher {

	private static final Logger logger = LoggerFactory.getLogger(TestPublisher.class);

	public static void main(String[] args){
		AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(HelloEventListener.class);

		//利用applicationContext发布事件
		ac.publishEvent(new HelloEvent(ac,"hello"));

		logger.info("Spring容器在启动后，会发布事件");
	}
}
